package com.kd.juhaowan.ui.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.kd.juhaowan.R;
import com.kd.juhaowan.http.model.GiftModel;
import com.kd.juhaowan.ui.holder.FuliDjqBannerPagerViewHolder;
import com.kd.juhaowan.ui.listener.OnReciveListener;
import com.youth.banner.adapter.BannerAdapter;

import java.util.List;

public class FuliDjqBannerPagerAdapter extends BannerAdapter<List<GiftModel>, FuliDjqBannerPagerViewHolder> {

    private boolean isMine;
    private OnReciveListener myListener;

    public FuliDjqBannerPagerAdapter(List<List<GiftModel>> datas, boolean isMined, OnReciveListener listener) {
        super(datas);
        this.isMine = isMined;
        myListener = listener;
    }

    @Override
    public FuliDjqBannerPagerViewHolder onCreateHolder(ViewGroup parent, int viewType) {
        LayoutInflater inflater = LayoutInflater.from(parent.getContext());
        View view = inflater.inflate(R.layout.item_fuli_banner, parent, false);
//        GameInfoImageViewHolder holder = new GameInfoImageViewHolder(view);
//        holder.setOnItemClickListener(getOnItemClickListener());
//        return holder;
//
//        ImageView imageView = new ImageView(parent.getContext());
//        imageView.setLayoutParams(new ViewGroup.LayoutParams(
//                ViewGroup.LayoutParams.MATCH_PARENT,
//                ViewGroup.LayoutParams.MATCH_PARENT));
//        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        return new FuliDjqBannerPagerViewHolder(view,parent.getContext(),isMine,myListener);
    }

    @Override
    public void onBindView(FuliDjqBannerPagerViewHolder holder, List<GiftModel> data, int position, int size) {
        holder.loadGoodsImage(data,position);
    }
}
